#include "stdafx.h"
#include "functions.h"
#include "vector3.h"
#include "matrix4x4.h"
#include <maths/vector.h>
#include <maths/matrix.h>
#include <maths/func.h>
#include <maths/trigo.h>

#include <math.h>

static black::mat3x3_128 m1( 2.f, 1.f, 2.f, 1.f, 2.f, 1.f, 2.f, 1.f, 2.f );

float test( float x )
{
	
	//black::mat3x3_128 m1( x, 1.f, x, 1.f, x, 1.f, x, 1.f, x );
	//black::mat3x3_128 m2( 2.f, 1.f, x, 1.f, x*2.f, 1.f, x, 1.f, x );
	//black::vec3 v2( 7.f, 4.f, x +1.f);

	//v1 = +v1;
	//m1.i().x = x;

	/*black::vec3_128 v2;
	m1.mul( v2, v1 );*/
	//m1.invert();
	/*m1.mul( v2, v2 );
	m1.mul( v2, v2 );
	m1.mul( v2, v2 );
	m1.mul( v2, v2 );
	m1.mul( v2, v2 );
	m1.mul( v2, v2 );
	m1.mul( v2, v2 );
	m1.mul( v2, v2 );*/

	//return m1.i().x;
	/*float fCos = ::cos( x );
	float fSin = ::sin( x );
	return fCos*fSin;*/
	/*black::vec3_128 v( 1.f+x, x+789.f, x+44.f );
	black::vec3_128 vv[4] = {black::vec3_128( x, x+1.f, x+2.f )
	, black::vec3_128( x*x, x-6.f, x+78.f )
	, black::vec3_128( x, x+x, x-18.f )
	, black::vec3_128( 12.f, x*15.f, x-x*x )};
	float res;
	res = v.dot( vv[0] );
	res += v.dot( vv[1] );
	res += v.dot( vv[2] );
	res += v.dot( vv[3] );
	return res;*/

	//return m1.isValid() ? x : 0;
	
	//return ::abs( x );
	//return ::abs( x );
	return (float)(( (int) x)+1);
}

float test2( float x )
{
	//black::mat3x3_128 m1( x, 1.f, x, 1.f, x, 1.f, x, 1.f, x );
	//black::mat3x3_128 m2( 2.f, 1.f, x, 1.f, x*2.f, 1.f, x, 1.f, x );
	//black::vec3 v2( 7.f, 4.f, x +1.f);

	//v1 = +v1;
	//m1.i().x = x;

	/*black::vec3_128 v2;
	m1.mul( v2, v1 );*/
	//m1.invertsse();
	/*m1.mul( v2, v2 );
	m1.mul( v2, v2 );
	m1.mul( v2, v2 );
	m1.mul( v2, v2 );
	m1.mul( v2, v2 );
	m1.mul( v2, v2 );
	m1.mul( v2, v2 );
	m1.mul( v2, v2 );*/

	//return m1.i().x;
	/*float fCos, fSin;
	black::sinCos( fSin, fCos, x );
	return fCos * fSin;*/
	/*black::vec3_128 v( 1.f+x, x+789.f, x+44.f );
	black::vec3_128 vv[4] = {black::vec3_128( x, x+1.f, x+2.f )
		, black::vec3_128( x*x, x-6.f, x+78.f )
		, black::vec3_128( x, x+x, x-18.f )
		, black::vec3_128( 12.f, x*15.f, x-x*x )};

	black::data128 d;
	d.m128 = v.dot( vv );
	d.m128 = _mm_hadd_ps( d.m128, d.m128 );
	d.m128 = _mm_hadd_ps( d.m128, d.m128 );
	return d.f[0];*/
	/*float res;
	res = d.f[0];
	res += d.f[1];
	res += d.f[2];
	res += d.f[3];
	return res;*/

	//return m1.isValid() ? x : 0;
	
	//return black::abs( x );
	//return black::abs( x );
	return (float)(( black::roundToInt(x) )+1);
}
